/**
 */
package org.mro.grib.model.files.secondEdition.products.impl;

import java.nio.ByteBuffer;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

import org.mro.grib.model.files.secondEdition.products.ProductDefinitionTemplate41002;
import org.mro.grib.model.files.secondEdition.products.ProductsPackage;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Product Definition Template41002</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link org.mro.grib.model.files.secondEdition.products.impl.ProductDefinitionTemplate41002Impl#getHorizontalDimensionProcessed <em>Horizontal Dimension Processed</em>}</li>
 *   <li>{@link org.mro.grib.model.files.secondEdition.products.impl.ProductDefinitionTemplate41002Impl#getTreatmentOfMissingData <em>Treatment Of Missing Data</em>}</li>
 *   <li>{@link org.mro.grib.model.files.secondEdition.products.impl.ProductDefinitionTemplate41002Impl#getTypeOfStatisticalProcessing <em>Type Of Statistical Processing</em>}</li>
 *   <li>{@link org.mro.grib.model.files.secondEdition.products.impl.ProductDefinitionTemplate41002Impl#getStartOfRange <em>Start Of Range</em>}</li>
 *   <li>{@link org.mro.grib.model.files.secondEdition.products.impl.ProductDefinitionTemplate41002Impl#getEndOfRange <em>End Of Range</em>}</li>
 *   <li>{@link org.mro.grib.model.files.secondEdition.products.impl.ProductDefinitionTemplate41002Impl#getNumberOfValues <em>Number Of Values</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class ProductDefinitionTemplate41002Impl extends ProductDefinitionTemplate41000Impl implements ProductDefinitionTemplate41002 {
	/**
	 * The default value of the '{@link #getHorizontalDimensionProcessed() <em>Horizontal Dimension Processed</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getHorizontalDimensionProcessed()
	 * @generated
	 * @ordered
	 */
	protected static final byte HORIZONTAL_DIMENSION_PROCESSED_EDEFAULT = 0x00;

	/**
	 * The cached value of the '{@link #getHorizontalDimensionProcessed() <em>Horizontal Dimension Processed</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getHorizontalDimensionProcessed()
	 * @generated
	 * @ordered
	 */
	protected byte horizontalDimensionProcessed = HORIZONTAL_DIMENSION_PROCESSED_EDEFAULT;

	/**
	 * The default value of the '{@link #getTreatmentOfMissingData() <em>Treatment Of Missing Data</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getTreatmentOfMissingData()
	 * @generated
	 * @ordered
	 */
	protected static final byte TREATMENT_OF_MISSING_DATA_EDEFAULT = 0x00;

	/**
	 * The cached value of the '{@link #getTreatmentOfMissingData() <em>Treatment Of Missing Data</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getTreatmentOfMissingData()
	 * @generated
	 * @ordered
	 */
	protected byte treatmentOfMissingData = TREATMENT_OF_MISSING_DATA_EDEFAULT;

	/**
	 * The default value of the '{@link #getTypeOfStatisticalProcessing() <em>Type Of Statistical Processing</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getTypeOfStatisticalProcessing()
	 * @generated
	 * @ordered
	 */
	protected static final byte TYPE_OF_STATISTICAL_PROCESSING_EDEFAULT = 0x00;

	/**
	 * The cached value of the '{@link #getTypeOfStatisticalProcessing() <em>Type Of Statistical Processing</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getTypeOfStatisticalProcessing()
	 * @generated
	 * @ordered
	 */
	protected byte typeOfStatisticalProcessing = TYPE_OF_STATISTICAL_PROCESSING_EDEFAULT;

	/**
	 * The default value of the '{@link #getStartOfRange() <em>Start Of Range</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getStartOfRange()
	 * @generated
	 * @ordered
	 */
	protected static final int START_OF_RANGE_EDEFAULT = 0;

	/**
	 * The cached value of the '{@link #getStartOfRange() <em>Start Of Range</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getStartOfRange()
	 * @generated
	 * @ordered
	 */
	protected int startOfRange = START_OF_RANGE_EDEFAULT;

	/**
	 * The default value of the '{@link #getEndOfRange() <em>End Of Range</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getEndOfRange()
	 * @generated
	 * @ordered
	 */
	protected static final int END_OF_RANGE_EDEFAULT = 0;

	/**
	 * The cached value of the '{@link #getEndOfRange() <em>End Of Range</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getEndOfRange()
	 * @generated
	 * @ordered
	 */
	protected int endOfRange = END_OF_RANGE_EDEFAULT;

	/**
	 * The default value of the '{@link #getNumberOfValues() <em>Number Of Values</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getNumberOfValues()
	 * @generated
	 * @ordered
	 */
	protected static final int NUMBER_OF_VALUES_EDEFAULT = 0;

	/**
	 * The cached value of the '{@link #getNumberOfValues() <em>Number Of Values</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getNumberOfValues()
	 * @generated
	 * @ordered
	 */
	protected int numberOfValues = NUMBER_OF_VALUES_EDEFAULT;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ProductDefinitionTemplate41002Impl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return ProductsPackage.Literals.PRODUCT_DEFINITION_TEMPLATE41002;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public byte getHorizontalDimensionProcessed() {
		return horizontalDimensionProcessed;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setHorizontalDimensionProcessed(byte newHorizontalDimensionProcessed) {
		byte oldHorizontalDimensionProcessed = horizontalDimensionProcessed;
		horizontalDimensionProcessed = newHorizontalDimensionProcessed;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ProductsPackage.PRODUCT_DEFINITION_TEMPLATE41002__HORIZONTAL_DIMENSION_PROCESSED, oldHorizontalDimensionProcessed, horizontalDimensionProcessed));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public byte getTreatmentOfMissingData() {
		return treatmentOfMissingData;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setTreatmentOfMissingData(byte newTreatmentOfMissingData) {
		byte oldTreatmentOfMissingData = treatmentOfMissingData;
		treatmentOfMissingData = newTreatmentOfMissingData;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ProductsPackage.PRODUCT_DEFINITION_TEMPLATE41002__TREATMENT_OF_MISSING_DATA, oldTreatmentOfMissingData, treatmentOfMissingData));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public byte getTypeOfStatisticalProcessing() {
		return typeOfStatisticalProcessing;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setTypeOfStatisticalProcessing(byte newTypeOfStatisticalProcessing) {
		byte oldTypeOfStatisticalProcessing = typeOfStatisticalProcessing;
		typeOfStatisticalProcessing = newTypeOfStatisticalProcessing;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ProductsPackage.PRODUCT_DEFINITION_TEMPLATE41002__TYPE_OF_STATISTICAL_PROCESSING, oldTypeOfStatisticalProcessing, typeOfStatisticalProcessing));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public int getStartOfRange() {
		return startOfRange;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setStartOfRange(int newStartOfRange) {
		int oldStartOfRange = startOfRange;
		startOfRange = newStartOfRange;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ProductsPackage.PRODUCT_DEFINITION_TEMPLATE41002__START_OF_RANGE, oldStartOfRange, startOfRange));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public int getEndOfRange() {
		return endOfRange;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setEndOfRange(int newEndOfRange) {
		int oldEndOfRange = endOfRange;
		endOfRange = newEndOfRange;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ProductsPackage.PRODUCT_DEFINITION_TEMPLATE41002__END_OF_RANGE, oldEndOfRange, endOfRange));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public int getNumberOfValues() {
		return numberOfValues;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setNumberOfValues(int newNumberOfValues) {
		int oldNumberOfValues = numberOfValues;
		numberOfValues = newNumberOfValues;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ProductsPackage.PRODUCT_DEFINITION_TEMPLATE41002__NUMBER_OF_VALUES, oldNumberOfValues, numberOfValues));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case ProductsPackage.PRODUCT_DEFINITION_TEMPLATE41002__HORIZONTAL_DIMENSION_PROCESSED:
				return getHorizontalDimensionProcessed();
			case ProductsPackage.PRODUCT_DEFINITION_TEMPLATE41002__TREATMENT_OF_MISSING_DATA:
				return getTreatmentOfMissingData();
			case ProductsPackage.PRODUCT_DEFINITION_TEMPLATE41002__TYPE_OF_STATISTICAL_PROCESSING:
				return getTypeOfStatisticalProcessing();
			case ProductsPackage.PRODUCT_DEFINITION_TEMPLATE41002__START_OF_RANGE:
				return getStartOfRange();
			case ProductsPackage.PRODUCT_DEFINITION_TEMPLATE41002__END_OF_RANGE:
				return getEndOfRange();
			case ProductsPackage.PRODUCT_DEFINITION_TEMPLATE41002__NUMBER_OF_VALUES:
				return getNumberOfValues();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case ProductsPackage.PRODUCT_DEFINITION_TEMPLATE41002__HORIZONTAL_DIMENSION_PROCESSED:
				setHorizontalDimensionProcessed((Byte)newValue);
				return;
			case ProductsPackage.PRODUCT_DEFINITION_TEMPLATE41002__TREATMENT_OF_MISSING_DATA:
				setTreatmentOfMissingData((Byte)newValue);
				return;
			case ProductsPackage.PRODUCT_DEFINITION_TEMPLATE41002__TYPE_OF_STATISTICAL_PROCESSING:
				setTypeOfStatisticalProcessing((Byte)newValue);
				return;
			case ProductsPackage.PRODUCT_DEFINITION_TEMPLATE41002__START_OF_RANGE:
				setStartOfRange((Integer)newValue);
				return;
			case ProductsPackage.PRODUCT_DEFINITION_TEMPLATE41002__END_OF_RANGE:
				setEndOfRange((Integer)newValue);
				return;
			case ProductsPackage.PRODUCT_DEFINITION_TEMPLATE41002__NUMBER_OF_VALUES:
				setNumberOfValues((Integer)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case ProductsPackage.PRODUCT_DEFINITION_TEMPLATE41002__HORIZONTAL_DIMENSION_PROCESSED:
				setHorizontalDimensionProcessed(HORIZONTAL_DIMENSION_PROCESSED_EDEFAULT);
				return;
			case ProductsPackage.PRODUCT_DEFINITION_TEMPLATE41002__TREATMENT_OF_MISSING_DATA:
				setTreatmentOfMissingData(TREATMENT_OF_MISSING_DATA_EDEFAULT);
				return;
			case ProductsPackage.PRODUCT_DEFINITION_TEMPLATE41002__TYPE_OF_STATISTICAL_PROCESSING:
				setTypeOfStatisticalProcessing(TYPE_OF_STATISTICAL_PROCESSING_EDEFAULT);
				return;
			case ProductsPackage.PRODUCT_DEFINITION_TEMPLATE41002__START_OF_RANGE:
				setStartOfRange(START_OF_RANGE_EDEFAULT);
				return;
			case ProductsPackage.PRODUCT_DEFINITION_TEMPLATE41002__END_OF_RANGE:
				setEndOfRange(END_OF_RANGE_EDEFAULT);
				return;
			case ProductsPackage.PRODUCT_DEFINITION_TEMPLATE41002__NUMBER_OF_VALUES:
				setNumberOfValues(NUMBER_OF_VALUES_EDEFAULT);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case ProductsPackage.PRODUCT_DEFINITION_TEMPLATE41002__HORIZONTAL_DIMENSION_PROCESSED:
				return horizontalDimensionProcessed != HORIZONTAL_DIMENSION_PROCESSED_EDEFAULT;
			case ProductsPackage.PRODUCT_DEFINITION_TEMPLATE41002__TREATMENT_OF_MISSING_DATA:
				return treatmentOfMissingData != TREATMENT_OF_MISSING_DATA_EDEFAULT;
			case ProductsPackage.PRODUCT_DEFINITION_TEMPLATE41002__TYPE_OF_STATISTICAL_PROCESSING:
				return typeOfStatisticalProcessing != TYPE_OF_STATISTICAL_PROCESSING_EDEFAULT;
			case ProductsPackage.PRODUCT_DEFINITION_TEMPLATE41002__START_OF_RANGE:
				return startOfRange != START_OF_RANGE_EDEFAULT;
			case ProductsPackage.PRODUCT_DEFINITION_TEMPLATE41002__END_OF_RANGE:
				return endOfRange != END_OF_RANGE_EDEFAULT;
			case ProductsPackage.PRODUCT_DEFINITION_TEMPLATE41002__NUMBER_OF_VALUES:
				return numberOfValues != NUMBER_OF_VALUES_EDEFAULT;
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (horizontalDimensionProcessed: "); //$NON-NLS-1$
		result.append(horizontalDimensionProcessed);
		result.append(", treatmentOfMissingData: "); //$NON-NLS-1$
		result.append(treatmentOfMissingData);
		result.append(", typeOfStatisticalProcessing: "); //$NON-NLS-1$
		result.append(typeOfStatisticalProcessing);
		result.append(", startOfRange: "); //$NON-NLS-1$
		result.append(startOfRange);
		result.append(", endOfRange: "); //$NON-NLS-1$
		result.append(endOfRange);
		result.append(", numberOfValues: "); //$NON-NLS-1$
		result.append(numberOfValues);
		result.append(')');
		return result.toString();
	}

	/* (non-Javadoc)
	 * @see org.mro.grib.model.files.secondEdition.products.impl.ProductDefinitionTemplate41000Impl#initialise(java.nio.ByteBuffer)
	 */
	@Override
	public void initialise(ByteBuffer buffer) {
		super.initialise(buffer);
		horizontalDimensionProcessed = buffer.get();
		treatmentOfMissingData = buffer.get();
		typeOfStatisticalProcessing = buffer.get();
		startOfRange = buffer.getInt();
		endOfRange = buffer.getInt();
		numberOfValues = buffer.getInt();
	}
	
} //ProductDefinitionTemplate41002Impl
